#include<iostream>
#define MAXV 100
using namespace std;

typedef struct {
	int numVertices, numEdges;	//顶点数、边数
	char VerticesList[MAXV];	//顶点表
	int Edge[MAXV][MAXV];		//邻接矩阵
}MGraph;

void init(MGraph &G) {          //初始化邻接矩阵
    // 设置顶点数和边数
    G.numVertices = 5;
    G.numEdges = 6;
    // 初始化顶点表
    char vertices[] = { 'A', 'B', 'C', 'D', 'E' };
    for (int i = 0; i < G.numVertices; i++) {
        G.VerticesList[i] = vertices[i];
    }
    // 初始化邻接矩阵（全部设为0）
    for (int i = 0; i < G.numVertices; i++) {
        for (int j = 0; j < G.numVertices; j++) {
            G.Edge[i][j] = 0;
        }
    }
    // 设置边（无向图，对称矩阵）
    // 边: A-B, A-C, B-C, B-D, C-D, D-E
    G.Edge[0][1] = G.Edge[1][0] = 1;  // A-B
    G.Edge[0][2] = G.Edge[2][0] = 1;  // A-C
    G.Edge[1][2] = G.Edge[2][1] = 1;  // B-C
    G.Edge[1][3] = G.Edge[3][1] = 1;  // B-D
    G.Edge[2][3] = G.Edge[3][2] = 1;  // C-D
    G.Edge[3][4] = G.Edge[4][3] = 1;  // D-E

}

int IsExistEL(MGraph G) {
	int count = 0;				//度数为奇数的顶点
	for (int i = 0; i < G.numVertices; ++i) {
		int dEdge = 0;			//度数
		for (int j = 0; j < G.numVertices; ++j) {
			if (G.Edge[i][j] == 1)
				dEdge++;
		}
		if (dEdge % 2 != 0)
			count++;
	}
	if (count == 2 || count == 0)
		return 1;               //当度数为奇数的顶点个数为不大于2的偶数时返回“1”
	return 0;
}

int main() {
    MGraph G;
    init(G);
    int ans = IsExistEL(G);
    cout << ans << endl;
    return 0;
}